package com.xdxc.model.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xdxc.emuns.QuestionType;
import com.xdxc.utils.JsonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 实体类对应数据库中的表 user_answer
 */
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName(value = "temp_user_answer", autoResultMap = true)
@Data
public class TempUserAnswer implements Serializable {

    @TableId(type = IdType.ASSIGN_ID) // MyBatis-Plus 雪花算法
    private Long id;

    private Long paperId;

    private Long quId;

    private QuestionType answerType;

    @TableField( value ="answer_ids",typeHandler = JsonTypeHandler.class)
    private List<Long> answerIds; // JSON 类型字段，存储选项 ID 集合

    private String answerText; // 文本答案
    @TableField(typeHandler = JsonTypeHandler.class)
    private List<String> answerFiles; // 文件路径集合

    private Integer version; // 版本号（乐观锁）

    private Boolean isEnd; // 逻辑删除标记

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private String answerTypeText;

    private Long userId;


    private Long examId;
    private Long checkId;

}
